<?php $cantidad = $orden['Ordene']['ordenescambio']; ?>
<?php $codOrden = $orden['Ordene']['id']; ?>

<?php for ($i = 1; $i <= $cantidad; $i++): ?>   
    <?php echo $this->Form->create('Cambiosorden'); ?>
    <div class="widget grid5">
        <div class="whead"><h6>ORDEN DE CAMBIO - <?php echo $orden['Ordene']['nombre']; ?> - 000<?php echo $i; ?></h6><div class="clear"></div></div>   
        <div class="clear"></div>              

        <div class="formRow"> 
            <div class="grid3"><label>Fecha :</label></div>
            <div class="grid9">
                <?php echo $this->Form->hidden("Cambiordene.$i.ordene_id", array('value' => $codOrden)); ?>
                <?php echo $this->Form->hidden("Cambiordene.$i.numero", array('value' => "000$i")); ?>
                <?php echo $this->Form->text("Cambiordene.$i.fecha", array('placeholder' => 'Ingrese Fecha', 'id' => "fecha$i")); ?>
            </div>
            <div class="clear"></div>
        </div>

        <div class="formRow"> 
            <div class="grid3"><label>Tiene CAF :</label></div>
            <div class="grid9">
                <?php echo $this->Form->checkbox("Cambiordene.$i.caf", array('value' => 1, 'hiddenField' => false)); ?>
            </div>
            <div class="clear"></div>
        </div>

        <div class="formRow">
            <div class="grid3"><label>Original :</label></div>
            <div class="grid3">            
                <?php echo $this->Form->checkbox("Cambiordene.$i.original", array('value' => 1, 'hiddenField' => false)); ?>
            </div>
            <div class="grid3"><label>Cant Firmas :</label></div>
            <div class="grid3">            
                <?php echo $this->Form->text("Cambiordene.$i.cantforiginal", array('value' => '0')); ?>
                <?php //echo $this->Form->checkbox("tagSel", array('value' => 1, 'hiddenField' => false)); ?>
            </div>
            <div class="clear"></div>
        </div>

        <div class="formRow">
            <div class="grid3"><label>Copias :</label></div>
            <div class="grid3">            
                <?php echo $this->Form->checkbox("Cambiordene.$i.original", array('value' => 1, 'hiddenField' => false)); ?>
            </div>
            <div class="grid3"><label>Cant Firmas :</label></div>
            <div class="grid3">            
                <?php echo $this->Form->text("Cambiordene.$i.cantfcopia", array('value' => '0')); ?>
                <?php //echo $this->Form->checkbox("tagSel", array('value' => 1, 'hiddenField' => false)); ?>
            </div>
            <div class="clear"></div>
        </div>
        <?php $s = $i+1; ?>
        <div class="formRow">   
            <div class="whead"><h6>ADICION TAGS PO No. 000<?php echo $i; ?></h6><div class="clear"></div></div> 
            <div class="grid3"><label>Tag :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.atag", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Activo :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.anactivo", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Monto :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.amonto", array('placeholder' => '')); ?>
            </div>
            <div class="clear"></div>      

            <div class="grid3"><label>Tag :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.atag", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Activo :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.anactivo", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Monto :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.amonto", array('placeholder' => '')); ?>
            </div>
            <div class="clear"></div>              
        </div>

        <div class="formRow">   
            <div class="whead"><h6>ELIMINAR TAGS PO No. 000-<?php echo $i; ?></h6><div class="clear"></div></div> 
            <div class="grid3"><label>Tag :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.etag", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Activo :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.enactivo", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Monto :</label>
                <?php echo $this->Form->text("CambiordenesTag.$i.emonto", array('placeholder' => '')); ?>
            </div>
            <div class="clear"></div>      

            <div class="grid3"><label>Tag :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.etag", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Activo :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.enactivo", array('placeholder' => '')); ?>
            </div>
            <div class="grid3"><label>Monto :</label>
                <?php echo $this->Form->text("CambiordenesTag.$s.emonto", array('placeholder' => '')); ?>
            </div>
            <div class="clear"></div>              
        </div>     

        <div class="clear"></div>  
        <div class="formRow">
            <?php
            $options = array(
                'label' => 'Guardar Datos',
                'class' => 'buttonS bLightBlue',
                'id' => 'btEnvia'
            );
            echo $this->Form->end($options);
            ?> 
            <div class="clear"></div>        
        </div>
    </div>
    <script>
        $(document).ready(function() {
                
            $( "#fecha<?php echo $i; ?>" ).datepicker({
                defaultDate: +7,
                showOtherMonths:true,
                autoSize: true,
                /*appendText: '(Ano-Mes-Dia)',*/
                dateFormat: 'yy-mm-dd',
                changeMonth: true,
                changeYear: true
            });      
        });
    </script>
<?php endfor; ?>